import random
c=1
gold=5000
right = random.randint(1, 100)
print(right)
print('开始第{}次游戏'.format(c))
while gold>=500:
    guess = int(input('请输入您猜测的数字:'))
    if guess > right:
        gold -= 500
        print('大了,扣除500金币，剩余金币为：{}'.format(gold))
    elif guess < right:
        gold -= 500
        print('小了,扣除500金币，剩余金币为：{}'.format(gold))
    else:
        gold += 3000
        print('恭喜猜中，本轮幸运数字：{}'.format(right))
        print('金币剩余：{}'.format(gold))
        again = (input('是否进入下一轮，请输入1(继续)或2（不继续）:'))
        if again == '1':
            c+=1
            right = random.randint(1, 100)
            print('开始第{}次游戏'.format(c))
           # print(right)
        else:
            print('退出游戏，欢迎再次来玩')
            break
else:
    print('剩余金币不足，退出游戏')